<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions" 
  xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
  targetNamespace="Examples"
  xmlns:tns="Examples">

  <message id="firstMessageId" name="firstMessage" />
  <message id="secondMessageId" name="secondMessage" />

  <process id="process" isExecutable="true">

    <startEvent id="theStart" />

    <sequenceFlow sourceRef="theStart" targetRef="fork" />
    
    <parallelGateway id="fork" />
    <sequenceFlow sourceRef="fork" targetRef="subProcess" />
    <sequenceFlow sourceRef="fork" targetRef="afterFork" />
    <userTask id="afterFork" />
    <sequenceFlow sourceRef="afterFork" targetRef="join" />
    
    <subProcess id="subProcess">
      <startEvent id="innerStart" />
      <sequenceFlow sourceRef="innerStart" targetRef="receiveTask" />
      <receiveTask id="receiveTask" messageRef="secondMessageId" />
      <sequenceFlow sourceRef="receiveTask" targetRef="innerEnd" />
      <endEvent id="innerEnd">
        <terminateEventDefinition id="terminateEventDefinition"/>
      </endEvent>
    </subProcess>

    <boundaryEvent id="messageBoundary" attachedToRef="subProcess" cancelActivity="false">
      <messageEventDefinition messageRef="firstMessageId" />
    </boundaryEvent>
    <sequenceFlow sourceRef="messageBoundary" targetRef="task1" />
    <userTask id="task1" />
    <sequenceFlow sourceRef="task1" targetRef="theEnd1" />
    <endEvent id="theEnd1" />

    <sequenceFlow sourceRef="subProcess" targetRef="task2" />
    <userTask id="task2" />
    <sequenceFlow sourceRef="task2" targetRef="join" />
    <parallelGateway id="join" />
    <sequenceFlow sourceRef="join" targetRef="theEnd2" />
    <endEvent id="theEnd2" />
  </process>

</definitions>
